import os,pickle


get_data = []

def save_value(data):
    file_path = "/root/txt/threshold.txt"
    try:
        with open(file_path, "wb") as f:
            pickle.dump(data, f)
        print("Saved to:", file_path)
    except Exception as e:
        print("Write error:", e)

def read_value():
    file_path = "/root/txt/threshold.txt"
    try:
        with open(file_path, "rb") as f:  # 二进制读取模式
            loaded_data = pickle.load(f)
        print("读取成功:", loaded_data)  # 输出: [[0, 100, -128, 127, -128, 127]]
        return loaded_data
    except Exception as e:
        print(f"读取失败: {e}")
        return None

save_value([[]])
# get_data = read_value()
# if get_data:
#     print(get_data)